package com.syher.zabbix.core.configure;

import com.syher.zabbix.core.zabbix.DefaultZabbixApi;
import com.syher.zabbix.core.zabbix.ZabbixApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author shenyuhang
 * @date 2018/07/16.
 **/
@Configuration
public class ZabbixConfigure {

    @Value("${zabbix.url}")
    private String zabbixUrl;
    @Value("${zabbix.user}")
    private String zabbixUser;
    @Value("${zabbix.pswd}")
    private String zabbixPswd;

    @Bean
    public ZabbixApi zabbixApi() {
        ZabbixApi api = new DefaultZabbixApi(zabbixUrl);
        api.login(zabbixUser, zabbixPswd);
        return api;
    }
}
